﻿using Sustainalytics.LongRunningTaskManager.Interface;

namespace Sustainalytics.LongRunningTaskManager.Tests
{
    public class MyTaskFileInMem : MyTaskBase
    {
        public static LongRunningTaskFileInMemResult ReturnValue
        {
            get
            {
                return new LongRunningTaskFileInMemResult
                    {
                        Contents = new byte[] { 4, 5, 6 },
                        EnforceInMemory = false,
                        FileName = "file.txt",
                        MimeType = "application/octet-stream"
                    };
            }
        }

        public static LongRunningTaskFileOnDiskResult TransformedValue
        {
            get
            {
                var settings = LongRunningTaskManagerSettings.FromConfig();

                var res = LongRunningTaskFileOnDiskResult.FromFileInMemResult("TaskResult", ReturnValue);

                return res;
            }
        }

        public override LongRunningTaskTypeEnum Type
        {
            get { return (LongRunningTaskTypeEnum)1004; }
        }

        public override object Start(LongRunningTaskContext context)
        {
            base.Start(context);

            return ReturnValue;
        }
    }
}
